package com.apusic.service;

import java.util.List;

import com.apusic.dao.TBaseDistrictDao;
import com.apusic.entity.TBaseDistrict;
import com.apusic.util.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Qualifier
@Service("districtService")
public class DistrictService{
	@Autowired
	private TBaseDistrictDao tBaseDistrictDao;

	public String getDistrict(TBaseDistrict district) {
		List<TBaseDistrict> list =tBaseDistrictDao.selectByObj(district);
		String objectToJson = JsonUtils.objectToJson(list);
		return objectToJson;
	}
	
	public List<TBaseDistrict> getDistrictList(TBaseDistrict district) {
		List<TBaseDistrict> list =tBaseDistrictDao.selectByObj(district);
		return list;
	}
	public List<TBaseDistrict> getCityData() {
		List<TBaseDistrict> cityData = tBaseDistrictDao.getCityData();
		return cityData;
	}

	public List<TBaseDistrict> selectCityData() {
		List<TBaseDistrict> selectCityData = tBaseDistrictDao.selectCityData();
		return selectCityData;
	}

	public List<TBaseDistrict> getParentDistrict(TBaseDistrict district) {
		return tBaseDistrictDao.getParentDistrict(district);
	}
	
	public List<TBaseDistrict> getDistricts(){
		return tBaseDistrictDao.getDistricts();
	}
}
